package persistent;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Access extends ManagerOnLSD {
	private String dbName = "TallerDiseno";

	public Connection connect() {
		Connection connection = null;
		try {
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			connection = DriverManager.getConnection(this.getUrl());
		} catch (ClassNotFoundException e) {
			System.out.println("Error de driver: " + e.getMessage());
			e.printStackTrace();
		} catch (SQLException e1) {
			System.out.println("Error de conexión: " + e1.getMessage());
			e1.printStackTrace();
		}
		return connection;
	}
	
	// Genera el string de conexión para cada base de datos
	public String getUrl() {
		return "jdbc:odbc:" + this.dbName;
	}
}